package com.speechb.config;

import com.speechb.common.logger.AppLoggerFactory;
import com.speechb.interceptor.AuthLoginInteceptor;
import com.speechb.interceptor.RequestInfoInterceptor;
import com.speechb.interceptor.RequestParamInteceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器配置
 * @author llj
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		//这里可以添加多个拦截器
		if (AppLoggerFactory.isDebugEnabled()) {
			registry.addInterceptor(new RequestInfoInterceptor()).addPathPatterns("/**");
		}
		registry.addInterceptor(new RequestParamInteceptor()).addPathPatterns("/**");
		registry.addInterceptor(new AuthLoginInteceptor()).addPathPatterns("/**");
	}

}
